<template>
  <view class="search-input">
    <!-- 输入框前边的图标 -->
    <uni-icons class="search-icon" type="search" />
    <!-- 输入框 -->
    <input v-model="inputValue" @change="change" class="inputInnner" placeholder="搜索关键字" />
    <!-- 确认按钮  -->
    <view @click="query" class="verifbtn flexcent">
      搜索
    </view>
  </view>
</template>

<script>
export default {
  name: "searchInput",
  data() {
    return {
      inputValue:''
    }
  },
  methods: {
    change(){
      this.$emit('change',this.inputValue)
    },
    query(){
      this.$emit('query',this.inputValue)
    },
  },
}
</script>

<style scoped lang="scss">
.search-input {
  display: flex;
  align-items: center;
  width: 100%;
  // padding: 10rpx;
  margin: 30rpx 0;
  background-color: $bg-color-white;
  border: 2rpx solid #ABABAB;
  border-radius: 30rpx;
  justify-content: space-between;

  // 输入框前边的图标
  .search-icon {
    opacity: 0.8;
    margin: 0 20rpx;
    font-size: 36rpx !important;
    color: #ababab !important;
  }

  // 输入框
  .inputInnner {
    flex: 1;
    height: 100%;
    font-size: 28rpx;
  }

  // 验证码按钮
  .verifbtn {
    height: 100%;
    background: #D81E06;
    padding: 15rpx;
    font-size: 28rpx;
    color: #FFF;
    padding: 30rpx;
    border-radius: 30rpx;
    margin-left: 30rpx;

    view {
      width: 140rpx;
      text-align-last: justify;
    }
  }
}
</style>
